package com.study.netProtocol.tcp;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author ysy
 * @version 1.0
 * @Title: TcpServer
 * @Note <b>ProjectName:</b> Pre-research
 * <br><b>PackageName:</b> com.study.netProtocol.tcp
 * <br><b>ClassName:</b>
 * <br><b>Date:</b>

 */
public class TcpServer {
    public static void main(String[] args) throws IOException {
        // 监听指定端口
        ServerSocket ss = new ServerSocket(6666);
        System.out.println("server is running...");
        for (;;) {
            Socket sock = ss.accept();
            System.out.println("connected from " + sock.getRemoteSocketAddress());
            Thread t = new TcpServerHandler(sock);
            t.start();
        }
    }
}
